<!DOCTYPE HTML>
<html>
<head>
<include file="Include:meta" />
<title>部门共享库-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">部门共享库</div>
		<div class="right">
			<div class="input-group left w250">
		    	<input type="text" id="keyword" value="{$keyword}" class="form-control" placeholder="按名称/附件搜索" autocomplete="off">
	    		<span class="input-group-btn">
	        		<button class="btn found_btn" type="button">搜索</button>
		    	</span>
		    </div>
			<if condition="(get_permission('BM',NULL,2) and strstr($center_id,$login_center_id)) or (get_permission('BM',NULL,1))">
				<a href="__APP__/Index/label_administration/type/3/classif/9/types/部门共享库/fcenter_id/{$center_id}/sz/1" class="btn left ml5" target="_blank">标签管理</a>
			</if>
			<if condition="((get_permission('BM',NULL,3)) and strstr($center_id,$login_center_id)) or (get_permission('BM',NULL,2) and strstr($center_id,$login_center_id)) or (get_permission('BM',NULL,1))">
				<a href="__APP__/Index/department_add/center_id/{$center_id}" class="btn left ml5">添加</a>
			</if>
		</div>
	</div>
	<div id="content">
		<if condition="$screen neq null">
		<div class="filter">
		<foreach name="screen" item="vo" key="k">
			<div <if condition="$k gt 3">class="filter-item hide"<else/>class="filter-item"</if>>
				<div class="filter-title">{$vo['first_name']}：</div>
				<ul class="filter-order filter-orders">
					<volist name="vo['second']" id="wo">
						<li <if condition="$wo['id'] eq $vo['tid']">class="current"</if>>
							<a href="javascript:;" tid="{$wo['id']}">{$wo['second_name']}<if condition="$sz_status['name4'] eq 1"><if condition="($wo['times'] neq 0) and ($wo['times'] neq -1)">({$wo['times']})</if></if></a>
						</li>
					</volist>
				</ul>
			</div>
		</foreach>
		<if condition="$screen_num gt 4">
			<div class="filter-more"><span class="more">更多筛选<i class="fa fa-angle-down"></i></span></div>
		</if>
		</if>
		</div>
		<div class="table-scrollx">
			<table class="table table-bordered table-hover">
				<tr class="table-header fixed-table-header">
					<td>名称</td>
					<td>附件</td>
					<td width="68">阅读量
						<if condition="($action1 eq NULL) or ($action1 eq -1)">
							<a href="__APP__/Index/department_list/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/down/action2/-1/action3/-1"><i class="glyphicon glyphicon-sort"></i></a>
						<elseif condition="$action1 eq 'up'"/>
							<a href="__APP__/Index/department_list/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/down/action2/-1/action3/-1"><i class="glyphicon glyphicon-sort-by-attributes"></i></a>
						<elseif condition="$action1 eq 'down'"/>
							<a href="__APP__/Index/department_list/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/up/action2/-1/action3/-1"><i class="glyphicon glyphicon-sort-by-attributes-alt"></i></a>
						</if>
					</td>
					<td width="68">评论量
						<if condition="($action2 eq NULL) or ($action2 eq -1)">
							<a href="__APP__/Index/department_list/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/-1/action2/down/action3/-1"><i class="glyphicon glyphicon-sort"></i></a>
						<elseif condition="$action2 eq 'up'"/>
							<a href="__APP__/Index/department_list/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/-1/action2/down/action3/-1"><i class="glyphicon glyphicon-sort-by-attributes"></i></a>
						<elseif condition="$action2 eq 'down'"/>
							<a href="__APP__/Index/department_list/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/-1/action2/up/action3/-1"><i class="glyphicon glyphicon-sort-by-attributes-alt"></i></a>
						</if>
					</td>
					<td width="140">添加人(日期)
						<if condition="($action3 eq NULL) or ($action3 eq -1)">
							<a href="__APP__/Index/department_list/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/-1/action2/-1/action3/down"><i class="glyphicon glyphicon-sort"></i></a>
						<elseif condition="$action3 eq 'up'"/>
							<a href="__APP__/Index/department_list/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/-1/action2/-1/action3/down"><i class="glyphicon glyphicon-sort-by-attributes"></i></a>
						<elseif condition="$action3 eq 'down'"/>
							<a href="__APP__/Index/department_list/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/-1/action2/-1/action3/up"><i class="glyphicon glyphicon-sort-by-attributes-alt"></i></a>
						</if>
					</td>
					<if condition="is_permission('BM',NULL,1)">
					<td width="74">管理</td>
					</if>
				</tr>
				<if condition="$result eq NULL">
				<tr><td class='text-center' <if condition="is_permission('BM',NULL,1)">colspan="6"<else/>colspan="5"</if>>暂无相关内容</td></tr>
				</if>
				<foreach name="result" item="vo">
					<tr>
						<td><a href="__APP__/Index/library_detail/id/{$vo['id']}/classif/9/type/{$vo['type']}/center_id/{$center_id}">{$vo['name']}</a></td>
						<td>
							{$vo['file_name']}<a href="{$vo['file_url']}" did="{$vo['id']}" target="_blank" data-toggle="tooltip" data-placement="right" title="下载" class="ml5"><i  zid="{$vo['id']}" class="glyphicon glyphicon-download-alt download"></i></a>
						</td>
						<td><a href="javascript:;" class="detail" mid="{$vo['id']}">{$vo['download_time']?$vo['download_time']:NULL}</a></td>
						<td>{$vo['comment_num']?$vo['comment_num']:NULL}</td>
						<td>{$vo['add_user']}({$vo['add_date']|substr=0,10})</td>
						<if condition="is_permission('BM',NULL,1)">
						<td class="nowrap">
							<if condition="((get_permission('BM',NULL,3)) and ($vo['add_uid'] eq $login_id)) or (get_permission('BM',NULL,2) and strstr($vo['center_id'],$login_center_id)) or (get_permission('BM',NULL,1))">
								<if condition="$vo['status'] eq 1">
									<if condition="get_permission('BM',NULL,1)">
									<a href="__APP__/Index/department_edit/id/{$vo['id']}/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/{$action1}/action2/{$action2}/action3/{$action3}" data-toggle="tooltip" data-placement="left" title="编辑"><i class="glyphicon glyphicon-edit"></i></a>
									<a href="javascript:;" zid="{$vo['id']}" action="delete" data-toggle="tooltip" data-placement="left" title="删除" class="delete ml5"><i class="glyphicon glyphicon-trash"></i></a>
									</if>
								<else />
									<a href="__APP__/Index/department_edit/id/{$vo['id']}/keyword/{$keyword}/center_id/{$center_id}/ids/{$ids}/action1/{$action1}/action2/{$action2}/action3/{$action3}" data-toggle="tooltip" data-placement="left" title="编辑"><i class="glyphicon glyphicon-edit"></i></a>
									<a href="javascript:;" zid="{$vo['id']}" action="delete" data-toggle="tooltip" data-placement="left" title="删除" class="delete ml5"><i class="glyphicon glyphicon-trash"></i></a>
								</if>
							</if>
						</td>
						</if>
					</tr>
				</foreach>
			</table>
		</div>
		<div class="pages">{$page}</div>
	</div>
</div>
<!--联系人详情-->
<div id="detailModal" class="modal hide fade">
	<div class="modal-dialog w500">
		<div class="modal-content">
			<div class="modal-header">
				<h4 id="myModalLabel">阅读详情</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body"></div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	//联系人详情
	$(".detail").on("click",function(){
		var mid = $(this).attr("mid");
		$.ajax({
			type:"POST",
			async:false,
			dataType:"json",
			data:{"id":mid,"action":"detail"},
			url:"__APP__/Index/library_ajax",
			success:function(data){
				var html = "<table class='table table-bordered'>";
					html += "<tr  class='table-header'><td>阅读人</td><td>阅读时间</td></tr>";
				for(var i=0;i<data.length;i++){
					html += "<tr>";
					html += "<td>"+data[i].add_user+"</td>";
					html += "<td>"+data[i].add_date+"</td>";
					html += "</tr>";
				}
				html+="</table>";
				$("#detailModal").find(".modal-body").html(html).end().modal();
			}
		});
	});
	//搜索
	$(".found_btn").keywordSearch("__APP__/Index/department_list/keyword/$keyword/center_id/{$center_id}/ids/{$ids}/action1/{$action1}/action2/{$action2}/action3/{$action3}");
	
	//删除列表
	$(".delete").ajaxModal({"title_text":"确认提示框","body_text":"您确定要删除吗？","url":"__APP__/Index/library_ajax","data":{"id":"zid","action":"action"}});
	
	//阅读
	$('.download').on("click",function(){
		var $zid = $(this).attr("zid");
		$.ajax({
			cache:false,
			type:"POST",
			dataType:"json",
			url:"__APP__/Index/library_ajax",
			data:{"id":$zid,"action":"download"}
		});
	});
	
	//分类
	$(".filter-orders").find("a").click(function(){
		var ids = "";
		$(this).parents("ul").find("li").removeAttr("class");
		$(this).parent("li").attr("class","current");
		$(".filter-orders").find("li").each(function(){
			if($(this).attr("class") == "current"){
				ids += $(this).find("a").attr("tid")+",";
			}
		});
		ids = ids.replace(/\,$/g,"");
		window.location.href = "__APP__/Index/department_list/keyword/{$keyword}/center_id/{$center_id}/ids/"+ids;
	});
	
	//swf展示
	$(".swf").click(function(){
		var id = $(this).attr("zid");
		window.open('__APP__/Index/swf_list/id/'+id+'/db/db_library_main', '', "width="+ (screen.availWidth - 10) +",height="+ (screen.availHeight-10) +",directories=no,location=no,menubar=no,scrollbars=no,resizeable=no,status=no,toolbar=no");
	});
});
</script>
</body>
</html>